<?php

namespace App\Http\Requests;


class SysRoleRequest extends BaseRequest
{
    public function rules()
    {
        return [
            'role_name' => 'required|between:1,30|unique:sys_role,role_name,'.$this->post('id'),
            'role_key' => 'required|between:1,100|unique:sys_role,role_key,'.$this->post('id'),
            'status' => 'required',
            'remark' => 'max:100',
        ];
    }

    public function messages()
    {
        return [
            'role_name.required' => '角色名称必须填写',
            'role_name.between' => '角色名称1-30个字符之间',
            'role_name.unique' => '角色名称已存在',
            'role_key.required' => '角色权限字符串必须填写',
            'role_key.between' => '角色权限字符串1-100个字符之间',
            'role_key.unique' => '角色权限字符串已存在',
            'remark.max' => '备注最多100字符',
            'status.required' => '请选择状态',
        ];
    }
}
